#pragma once
// MESSAGE MANUAL_CONTROL PACKING

#define MAVLINK_MSG_ID_MANUAL_CONTROL 200

MAVPACKED(
typedef struct __mavlink_manual_control_t {
 float abs_pitch; /*<  pitch.*/
 float abs_yaw; /*<  yaw.*/
 float abs_polar; /*<  polar.*/
 float rel_pitch; /*<  pitch.*/
 float rel_yaw; /*<  yaw.*/
 float res1; /*<  res1.*/
 float res2; /*<  res2.*/
 uint8_t com_mode; /*<  static or dynamic communication.*/
 uint8_t ctrl_mode; /*<  absolute or relative control.*/
}) mavlink_manual_control_t;

#define MAVLINK_MSG_ID_MANUAL_CONTROL_LEN 30
#define MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN 30
#define MAVLINK_MSG_ID_200_LEN 30
#define MAVLINK_MSG_ID_200_MIN_LEN 30

#define MAVLINK_MSG_ID_MANUAL_CONTROL_CRC 28
#define MAVLINK_MSG_ID_200_CRC 28



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_MANUAL_CONTROL { \
    200, \
    "MANUAL_CONTROL", \
    9, \
    {  { "com_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_manual_control_t, com_mode) }, \
         { "ctrl_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_manual_control_t, ctrl_mode) }, \
         { "abs_pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_manual_control_t, abs_pitch) }, \
         { "abs_yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_manual_control_t, abs_yaw) }, \
         { "abs_polar", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_manual_control_t, abs_polar) }, \
         { "rel_pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_manual_control_t, rel_pitch) }, \
         { "rel_yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_manual_control_t, rel_yaw) }, \
         { "res1", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_manual_control_t, res1) }, \
         { "res2", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_manual_control_t, res2) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_MANUAL_CONTROL { \
    "MANUAL_CONTROL", \
    9, \
    {  { "com_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_manual_control_t, com_mode) }, \
         { "ctrl_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_manual_control_t, ctrl_mode) }, \
         { "abs_pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_manual_control_t, abs_pitch) }, \
         { "abs_yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_manual_control_t, abs_yaw) }, \
         { "abs_polar", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_manual_control_t, abs_polar) }, \
         { "rel_pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_manual_control_t, rel_pitch) }, \
         { "rel_yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_manual_control_t, rel_yaw) }, \
         { "res1", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_manual_control_t, res1) }, \
         { "res2", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_manual_control_t, res2) }, \
         } \
}
#endif

/**
 * @brief Pack a manual_control message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param com_mode  static or dynamic communication.
 * @param ctrl_mode  absolute or relative control.
 * @param abs_pitch  pitch.
 * @param abs_yaw  yaw.
 * @param abs_polar  polar.
 * @param rel_pitch  pitch.
 * @param rel_yaw  yaw.
 * @param res1  res1.
 * @param res2  res2.
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_manual_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               uint8_t com_mode, uint8_t ctrl_mode, float abs_pitch, float abs_yaw, float abs_polar, float rel_pitch, float rel_yaw, float res1, float res2)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_MANUAL_CONTROL_LEN];
    _mav_put_float(buf, 0, abs_pitch);
    _mav_put_float(buf, 4, abs_yaw);
    _mav_put_float(buf, 8, abs_polar);
    _mav_put_float(buf, 12, rel_pitch);
    _mav_put_float(buf, 16, rel_yaw);
    _mav_put_float(buf, 20, res1);
    _mav_put_float(buf, 24, res2);
    _mav_put_uint8_t(buf, 28, com_mode);
    _mav_put_uint8_t(buf, 29, ctrl_mode);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN);
#else
    mavlink_manual_control_t packet;
    packet.abs_pitch = abs_pitch;
    packet.abs_yaw = abs_yaw;
    packet.abs_polar = abs_polar;
    packet.rel_pitch = rel_pitch;
    packet.rel_yaw = rel_yaw;
    packet.res1 = res1;
    packet.res2 = res2;
    packet.com_mode = com_mode;
    packet.ctrl_mode = ctrl_mode;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_MANUAL_CONTROL;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC);
}

/**
 * @brief Pack a manual_control message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param com_mode  static or dynamic communication.
 * @param ctrl_mode  absolute or relative control.
 * @param abs_pitch  pitch.
 * @param abs_yaw  yaw.
 * @param abs_polar  polar.
 * @param rel_pitch  pitch.
 * @param rel_yaw  yaw.
 * @param res1  res1.
 * @param res2  res2.
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_manual_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   uint8_t com_mode,uint8_t ctrl_mode,float abs_pitch,float abs_yaw,float abs_polar,float rel_pitch,float rel_yaw,float res1,float res2)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_MANUAL_CONTROL_LEN];
    _mav_put_float(buf, 0, abs_pitch);
    _mav_put_float(buf, 4, abs_yaw);
    _mav_put_float(buf, 8, abs_polar);
    _mav_put_float(buf, 12, rel_pitch);
    _mav_put_float(buf, 16, rel_yaw);
    _mav_put_float(buf, 20, res1);
    _mav_put_float(buf, 24, res2);
    _mav_put_uint8_t(buf, 28, com_mode);
    _mav_put_uint8_t(buf, 29, ctrl_mode);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN);
#else
    mavlink_manual_control_t packet;
    packet.abs_pitch = abs_pitch;
    packet.abs_yaw = abs_yaw;
    packet.abs_polar = abs_polar;
    packet.rel_pitch = rel_pitch;
    packet.rel_yaw = rel_yaw;
    packet.res1 = res1;
    packet.res2 = res2;
    packet.com_mode = com_mode;
    packet.ctrl_mode = ctrl_mode;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_MANUAL_CONTROL;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC);
}

/**
 * @brief Encode a manual_control struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param manual_control C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_manual_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_manual_control_t* manual_control)
{
    return mavlink_msg_manual_control_pack(system_id, component_id, msg, manual_control->com_mode, manual_control->ctrl_mode, manual_control->abs_pitch, manual_control->abs_yaw, manual_control->abs_polar, manual_control->rel_pitch, manual_control->rel_yaw, manual_control->res1, manual_control->res2);
}

/**
 * @brief Encode a manual_control struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param manual_control C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_manual_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_manual_control_t* manual_control)
{
    return mavlink_msg_manual_control_pack_chan(system_id, component_id, chan, msg, manual_control->com_mode, manual_control->ctrl_mode, manual_control->abs_pitch, manual_control->abs_yaw, manual_control->abs_polar, manual_control->rel_pitch, manual_control->rel_yaw, manual_control->res1, manual_control->res2);
}

/**
 * @brief Send a manual_control message
 * @param chan MAVLink channel to send the message
 *
 * @param com_mode  static or dynamic communication.
 * @param ctrl_mode  absolute or relative control.
 * @param abs_pitch  pitch.
 * @param abs_yaw  yaw.
 * @param abs_polar  polar.
 * @param rel_pitch  pitch.
 * @param rel_yaw  yaw.
 * @param res1  res1.
 * @param res2  res2.
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_manual_control_send(mavlink_channel_t chan, uint8_t com_mode, uint8_t ctrl_mode, float abs_pitch, float abs_yaw, float abs_polar, float rel_pitch, float rel_yaw, float res1, float res2)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_MANUAL_CONTROL_LEN];
    _mav_put_float(buf, 0, abs_pitch);
    _mav_put_float(buf, 4, abs_yaw);
    _mav_put_float(buf, 8, abs_polar);
    _mav_put_float(buf, 12, rel_pitch);
    _mav_put_float(buf, 16, rel_yaw);
    _mav_put_float(buf, 20, res1);
    _mav_put_float(buf, 24, res2);
    _mav_put_uint8_t(buf, 28, com_mode);
    _mav_put_uint8_t(buf, 29, ctrl_mode);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MANUAL_CONTROL, buf, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC);
#else
    mavlink_manual_control_t packet;
    packet.abs_pitch = abs_pitch;
    packet.abs_yaw = abs_yaw;
    packet.abs_polar = abs_polar;
    packet.rel_pitch = rel_pitch;
    packet.rel_yaw = rel_yaw;
    packet.res1 = res1;
    packet.res2 = res2;
    packet.com_mode = com_mode;
    packet.ctrl_mode = ctrl_mode;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MANUAL_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC);
#endif
}

/**
 * @brief Send a manual_control message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_manual_control_send_struct(mavlink_channel_t chan, const mavlink_manual_control_t* manual_control)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_manual_control_send(chan, manual_control->com_mode, manual_control->ctrl_mode, manual_control->abs_pitch, manual_control->abs_yaw, manual_control->abs_polar, manual_control->rel_pitch, manual_control->rel_yaw, manual_control->res1, manual_control->res2);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MANUAL_CONTROL, (const char *)manual_control, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC);
#endif
}

#if MAVLINK_MSG_ID_MANUAL_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_manual_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint8_t com_mode, uint8_t ctrl_mode, float abs_pitch, float abs_yaw, float abs_polar, float rel_pitch, float rel_yaw, float res1, float res2)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_float(buf, 0, abs_pitch);
    _mav_put_float(buf, 4, abs_yaw);
    _mav_put_float(buf, 8, abs_polar);
    _mav_put_float(buf, 12, rel_pitch);
    _mav_put_float(buf, 16, rel_yaw);
    _mav_put_float(buf, 20, res1);
    _mav_put_float(buf, 24, res2);
    _mav_put_uint8_t(buf, 28, com_mode);
    _mav_put_uint8_t(buf, 29, ctrl_mode);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MANUAL_CONTROL, buf, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC);
#else
    mavlink_manual_control_t *packet = (mavlink_manual_control_t *)msgbuf;
    packet->abs_pitch = abs_pitch;
    packet->abs_yaw = abs_yaw;
    packet->abs_polar = abs_polar;
    packet->rel_pitch = rel_pitch;
    packet->rel_yaw = rel_yaw;
    packet->res1 = res1;
    packet->res2 = res2;
    packet->com_mode = com_mode;
    packet->ctrl_mode = ctrl_mode;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MANUAL_CONTROL, (const char *)packet, MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN, MAVLINK_MSG_ID_MANUAL_CONTROL_CRC);
#endif
}
#endif

#endif

// MESSAGE MANUAL_CONTROL UNPACKING


/**
 * @brief Get field com_mode from manual_control message
 *
 * @return  static or dynamic communication.
 */
static inline uint8_t mavlink_msg_manual_control_get_com_mode(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint8_t(msg,  28);
}

/**
 * @brief Get field ctrl_mode from manual_control message
 *
 * @return  absolute or relative control.
 */
static inline uint8_t mavlink_msg_manual_control_get_ctrl_mode(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint8_t(msg,  29);
}

/**
 * @brief Get field abs_pitch from manual_control message
 *
 * @return  pitch.
 */
static inline float mavlink_msg_manual_control_get_abs_pitch(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  0);
}

/**
 * @brief Get field abs_yaw from manual_control message
 *
 * @return  yaw.
 */
static inline float mavlink_msg_manual_control_get_abs_yaw(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  4);
}

/**
 * @brief Get field abs_polar from manual_control message
 *
 * @return  polar.
 */
static inline float mavlink_msg_manual_control_get_abs_polar(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  8);
}

/**
 * @brief Get field rel_pitch from manual_control message
 *
 * @return  pitch.
 */
static inline float mavlink_msg_manual_control_get_rel_pitch(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  12);
}

/**
 * @brief Get field rel_yaw from manual_control message
 *
 * @return  yaw.
 */
static inline float mavlink_msg_manual_control_get_rel_yaw(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  16);
}

/**
 * @brief Get field res1 from manual_control message
 *
 * @return  res1.
 */
static inline float mavlink_msg_manual_control_get_res1(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  20);
}

/**
 * @brief Get field res2 from manual_control message
 *
 * @return  res2.
 */
static inline float mavlink_msg_manual_control_get_res2(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  24);
}

/**
 * @brief Decode a manual_control message into a struct
 *
 * @param msg The message to decode
 * @param manual_control C-struct to decode the message contents into
 */
static inline void mavlink_msg_manual_control_decode(const mavlink_message_t* msg, mavlink_manual_control_t* manual_control)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    manual_control->abs_pitch = mavlink_msg_manual_control_get_abs_pitch(msg);
    manual_control->abs_yaw = mavlink_msg_manual_control_get_abs_yaw(msg);
    manual_control->abs_polar = mavlink_msg_manual_control_get_abs_polar(msg);
    manual_control->rel_pitch = mavlink_msg_manual_control_get_rel_pitch(msg);
    manual_control->rel_yaw = mavlink_msg_manual_control_get_rel_yaw(msg);
    manual_control->res1 = mavlink_msg_manual_control_get_res1(msg);
    manual_control->res2 = mavlink_msg_manual_control_get_res2(msg);
    manual_control->com_mode = mavlink_msg_manual_control_get_com_mode(msg);
    manual_control->ctrl_mode = mavlink_msg_manual_control_get_ctrl_mode(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_MANUAL_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_MANUAL_CONTROL_LEN;
        memset(manual_control, 0, MAVLINK_MSG_ID_MANUAL_CONTROL_LEN);
    memcpy(manual_control, _MAV_PAYLOAD(msg), len);
#endif
}
